<template>
  <div class="userlist-wrap">
    <el-table :data="recordData" border style="width: 100%;margin: 20px 0" header-cell-class-name="table-header">
      <el-table-column prop="id" label="ID" width="140" align="center"></el-table-column>
      <el-table-column prop="ip" label="IP" width="200" align="center"></el-table-column>
      <el-table-column prop="path" label="请求路径" width="220" align="center">
      </el-table-column>
      <el-table-column prop="method" label="请求方法" width="150" align="center"></el-table-column>
      <el-table-column prop="admin.username" label="操作员" align="center"></el-table-column>
    </el-table>
    <el-pagination
            background
            layout="total, prev, pager, next"
            :current-page="recordMeta.page"
            :page-size="recordMeta.limit"
            :total="recordMeta.total"
            @current-change="handlePageChange"
    ></el-pagination>
  </div>
</template>

<script>
  export default {
    name: 'record',
    data() {
      return {
        recordMeta: {},
        recordData: [],
        page: 1
      }
    },
    created() {
      this.getRecordList()
    },
    methods: {
      handlePageChange(page) {
        this.page = page
        this.getRecordList()
      },
      async getRecordList() {
        const {data} = await this.$http.get('api/admin/operation/logs', {params: {page: this.page}})
        console.log(data, '我的日志啊')
        this.recordData = data.data.data.data
        this.recordMeta = data.data.meta
      }
    }
  }
</script>

<style scoped>
  .userlist-wrap{
    background-color: #fff;
    border-radius: 4px;
    border: 1px solid #ddd;
    padding: 30px;
    box-sizing: border-box;
  }
</style>
